@import "../common/var.styl"
.bin-switch {
  display: inline-block;
  width: 44px;
  height: 22px;
  line-height: 20px;
  border-radius: 22px;
  vertical-align: middle;
  border: 1px solid #ccc;
  background-color: #ccc;
  position: relative;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  transition: all .2s ease-in-out;
  &:after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 18px;
    background-color: #fff;
    cursor: pointer;
    transition: left .2s ease-in-out, width .2s ease-in-out;
  }
  &:focus {
    box-shadow: 0 0 0 2px rgba(45, 140, 240, .2);
    outline: 0;
  }
  &:active:after {
    width: 26px;
  }
}

.bin-switch-inner {
  color: #fff;
  font-size: 12px;
  position: absolute;
  left: 23px;
  i {
    text-align: center;
    position: relative;
    font-size: 18px;
    top: -1px;
  }
}


.bin-switch-checked {
  border-color: $color-primary;
  background-color: $color-primary;
  &:after {
    left: 22px;
  }
  &:active:after {
    left: 16px;
  }
  .bin-switch-inner {
    left: 6px;
  }
}
.bin-switch-large {
  width: 54px;
  &.bin-switch-checked:after {
    left: 32px;
  }

  &:active {
    &.bin-switch-checked:after {
      left: 22px;
    }
    &:after {
      width: 30px;
    }
  }
}
.bin-switch-small {
  width: 28px;
  height: 16px;
  line-height: 14px;
  &.bin-switch-checked:after {
    left: 12px;
  }
  &:after {
    width: 14px;
    height: 14px;
  }
  &:active {
    &.bin-switch-checked:after {
      left: 10px;
    }
    &:after {
      width: 16px;
    }
  }
}

.bin-switch-disabled {
  cursor: not-allowed;
  opacity: .4;
}
